home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 2 / LSD and 17bit Compendium Deluxe - Volume II.iso / a / prog / misc / guienv374.lha / GUIEnvironment / M2Amiga / Examples / BOOPSIExample.mod next >
Text File  |  1994-10-31  |  4KB  |  106 lines

  1. (****************************************************************************
  2.  
  3. $RCSfile: BOOPSIExample.mod $
  4.  
  5. $Revision: 1.5 $
  6.     $Date: 1994/10/31 17:11:09 $
  7.  
  8.     GUIEnvironment example: BOOPSI gadgets
  9.  
  10.     M2Amiga Modula-2 Compiler V4.3
  11.  
  12.   Copyright © 1994, Carsten Ziegeler
  13.                     Augustin-Wibbelt-Str.7, 33106 Paderborn, Germany
  14.  
  15. ****************************************************************************)
  16. MODULE BOOPSIExample;
  17.  
  18.  
  19.   FROM SYSTEM     IMPORT ADR, ADDRESS, CAST, TAG;
  20.   FROM IntuitionD IMPORT WindowPtr, WindowFlagSet, WindowFlags, IDCMPFlagSet,
  21.                          IDCMPFlags, WaTags, IcaTags, PgaTags, StringaTags;
  22.  
  23.   FROM GUIEnvSupport IMPORT GADDESC, GADOBJS, TopazAttr;
  24.  
  25. IMPORT D:GUIEnvD, L:GUIEnvL;
  26.  
  27.  
  28. TYPE ARR=ARRAY[0..2] OF LONGCARD;
  29.  
  30. CONST version = ADR("$VER: BOOPSIExample 37.4 (31.10.94)\n");
  31.  
  32.      int2propmap = ARR{LONGCARD(stringaLongVal), LONGCARD(pgaTop), 0};
  33.      prop2intmap = ARR{LONGCARD(pgaTop), LONGCARD(stringaLongVal), 0};
  34.  
  35.  
  36. VAR win : WindowPtr;
  37.     gui : D.GUIInfoPtr;
  38.     tagbuf : ARRAY[0..19] OF LONGCARD;
  39.  
  40.  
  41. BEGIN
  42.  
  43.   win := L.OpenGUIWindowA( 50, 50, 150, 150, ADR("GUIEnvironment - BOOPSIExample"),
  44.                           IDCMPFlagSet{closeWindow, newSize,
  45.                                        refreshWindow},
  46.                           WindowFlagSet{activate, windowSizing,
  47.                                         windowDepth, windowClose,
  48.                                         windowDrag}, NIL,
  49.                           TAG(tagbuf, waMinWidth, 250,
  50.                                       waMinHeight,120,
  51.                                       waMaxWidth, 500,
  52.                                       waMaxHeight,200, NIL));
  53.   IF win # NIL THEN
  54.  
  55.     gui := L.CreateGUIInfoA(win, TAG(tagbuf, D.guiCreationFont, TopazAttr(), NIL));
  56.     IF gui # NIL THEN
  57.  
  58.       L.CreateGUIGadgetA(gui, 10, 20, 10, -10, D.gegBOOPSIPublicKind,
  59.                          TAG(tagbuf, D.gegClass, ADR("propgclass"),
  60.                                      D.gegDescription, GADDESC(D.gegDistAbs+D.gegObjBorder+D.gegObjLeft,
  61.                                                                D.gegDistAbs+D.gegObjBorder+D.gegObjTop,
  62.                                                                D.gegDistNorm,
  63.                                                                D.gegDistAbs+D.gegObjBorder+D.gegObjBottom),
  64.                                      icaMap, ADR(prop2intmap),
  65.                                      pgaTotal, 100,
  66.                                      pgaTop, 25,
  67.                                      pgaVisible,10,
  68.                                      pgaNewLook, TRUE, NIL));
  69.  
  70.       L.CreateGUIGadgetA(gui, 10, 10, -10, 18, D.gegBOOPSIPublicKind,
  71.                          TAG(tagbuf, D.gegClass, ADR("strgclass"),
  72.                                      D.gegDescription, GADDESC(D.gegDistAbs+D.gegObjGadget+D.gegObjRight,
  73.                                                                D.gegDistAbs+D.gegObjBorder+D.gegObjTop,
  74.                                                                D.gegDistAbs+D.gegObjBorder+D.gegObjRight,
  75.                                                                D.gegDistNorm),
  76.                                      icaMap, ADR(int2propmap),
  77.                                      icaTarget, L.GetGUIGadget(gui, 0, D.gegAddress),
  78.                                      stringaLongVal, 25,
  79.                                      stringaMaxChars, 3, NIL));
  80.       L.SetGUIGadgetA(gui, 0, TAG(tagbuf, icaTarget, L.GetGUIGadget(gui, 1, D.gegAddress), NIL));
  81.  
  82.       IF L.DrawGUIA(gui, NIL) = D.geDone THEN
  83.  
  84.         LOOP
  85.           L.WaitGUIMsg(gui);
  86.  
  87.           IF    closeWindow IN gui^.msgClass THEN
  88.             EXIT;
  89.           ELSIF newSize     IN gui^.msgClass THEN
  90.             (* We only get these messages if an error occurs while
  91.                GUIEnv does the resizing, so we have to EXIT ! *)
  92.             EXIT;
  93.           END;
  94.         END;
  95.       END;
  96.  
  97.     END;
  98.   END;
  99.  
  100. CLOSE
  101.   IF win # NIL THEN
  102.     L.CloseGUIWindow(win);
  103.     win := NIL;
  104.   END;
  105. END BOOPSIExample.
  106.